<?php

		

		//右侧分类列表

		$cateModel = new \Common\Model\Cate;

		$arcModel = new \Common\Model\Arc;

		$tagModel= new \Common\Model\Tag;

		$arcTagModel=new \Common\Model\ArcTag;

		//中间表

		$arcTagModel = new \Common\Model\ArcTag;

		$cateData = $cateModel->get();

		//获取最新的文章

		$arcData=$arcModel->where('is_recycle=0')->orderBy('sendtime','ASC')->limit(4)->get();

		foreach ($cateData as $key => $v) {

			$cateData[$key]['count'] = $arcModel

						->where("category_cid={$v['cid']} and is_recycle=0")

						->count();

		}

		//站长推荐的文章

		$tagData=$tagModel->get();

		foreach($tagData as $k=>$val){

			$tagData[$k]['count']=$arcTagModel

						->join('article','aid','=','article_aid')

						->where("tag_tid={$val['tid']} and is_recycle=0")

						->count();

		}

		//站长推荐

		$randData = Db::select("select * from article where is_recycle=0 order by rand() limit 6");

		//图文推荐

		$arcData=$arcModel

						->where('is_recycle=0')

						->orderBy('sendtime','ASC')

						->limit(4)

						->get();

			foreach($arcData as $a=>$av){

				$arcData[$a]['tag']=$arcTagModel

								->join('tag','tid','=','tag_tid')

								->where("article_aid={$av['aid']}")					

								->get();

			}

		//点击排行榜

		$orderBy=Db::select('select * from article where is_recycle=0 order by click desc limit 5');

//		p($orderBy);
                $link=new \Common\Model\Link;
		$linkData=$link->get();

?>



<!--右边内容开始-->

  <!--关注我-->

  <div class="r_box f_r">

    <div class="tit01">

    </div>

    <!--tit01 end-->

    <!--<div class="ad300x100"> <img src="./Public/Home/images/ad300x100.jpg"> </div>-->

    

    <div class="moreSelect" id="lp_right_select"> 

      <script>

window.onload = function ()

{

	var oLi = document.getElementById("tab").getElementsByTagName("li");

	var oUl = document.getElementById("ms-main").getElementsByTagName("div");

	

	for(var i = 0; i < oLi.length; i++)

	{

		oLi[i].index = i;

		oLi[i].onmouseover = function ()

		{

			for(var n = 0; n < oLi.length; n++) oLi[n].className="";

			this.className = "cur";

			for(var n = 0; n < oUl.length; n++) oUl[n].style.display = "none";

			oUl[this.index].style.display = "block"

		}	

	}

}

</script>

      <div class="ms-top">

        <ul class="hd" id="tab">

          <li class="cur"><a href="javascript:;">点击排行</a></li>

          <li><a href="javascript:;">最新文章</a></li>

          <li><a href="javascript:;">站长推荐</a></li>

        </ul>

      </div>

      <div class="ms-main" id="ms-main">

      	<!--点击排行-->

        <div style="display: block;" class="bd bd-news" >

          <ul>

          	<?php foreach ($orderBy as $ob){?>

            	<li><a href="Content_<?php echo $ob['aid']?>.html" target="_blank"><?php echo $ob['title']?></a></li>

            <?php }?>

          </ul>

        </div>

        <!--点击排行结束-->

        <!--最新文章-->

        <div  class="bd bd-news">

          <ul>

          	<?php foreach ($arcData as $a){?>

           		 <li><a href="Content_<?php echo $a['aid']?>.html" target="_blank"><?php echo $a['title']?></a></li>

            <?php }?>

          </ul>

        </div>

        <!--站长推荐-->

        <div class="bd bd-news">

          <ul>

          	<?php foreach ($randData as $r){?>

            <li>

            	<a href="Content_<?php echo $r['aid']?>.html" target="_blank"><?php echo $r['title']?></a>

            </li>

            <?php }?>

          </ul>

        </div>

      </div>

      <!--ms-main end --> 

    </div>

    <!--切换卡 moreSelect end -->

    

    <div class="cloud">

      <h3>标签云</h3>

      <ul>

      	<?php foreach ($tagData as $v){?>

        <li>

        	<a href="list_<?php echo $v['tid']?>.html"><?php echo $v['tname']?></a>

        </li>

        <?php }?>

      </ul>

    </div>

    <!--图文推荐-->

	    <div class="tuwen">

	      <h3>图文推荐</h3>

	      <ul>

	      	<?php foreach ($arcData as $ad){?>

	        <li>

	        	<a href="Content_<?php echo $ad['aid']?>.html">

	        		<img src="<?php echo $ad['thumb']?>">

	        			<b><?php echo $ad['title']?></b>

	        	</a>

	          <p>

	          		<?php foreach ($ad['tag'] as $bb){?>

	          		 <span class="tulanmu">

	          		 		<a href="list_<?php echo $bb['tid']?>.html"><?php echo $bb['tname']?></a>

	          		 </span> 

	          		<?php }?>

	          	   <span class="tutime"><?php echo date('Y-m-d',$ad['sendtime'])?></span>

	          </p>

	        </li>

	        <?php }?>

	      </ul>

	    </div>

    <!--图文推荐结束-->

    <!--<div class="ad"> <img src="./Public/Home/images/03.jpg"> </div>-->

    <h3><span>[<a href="javascript:;">微信号</a>]</span></h3>

    <div class="ad"><img src="./Public/home/images/me.bmp"></div>

    <div class="links">

      <h3><span><a href="javascript:;"></a></span>友情链接</h3>

      <ul>
           <?php foreach ($linkData as $ld){?>
                   <li>
                          <a href="<?php echo $ld['url']?>" target="_blank"><?php echo $ld['lname']?></a>
                  </li>
          <?php }?>
      </ul>

    </div>

  </div>

  <!--右边结束-->